<?php
class category {
	private $cat_id;
	private $cat_name;
	private $cat_description;
	private $cat_root;
	private $priority;
	private $dispose;
	private $url_rewrite;
	
	// set get cat_id
	public function setcatid($cat_id) {
		$this->cat_id = $cat_id;
	}
	public function getcat_id() {
		return $this->cat_id;
	}
	// set get cat_name
	public function setcatname($cat_name) {
		$this->cat_name = $cat_name;
	}
	public function getcatname() {
		return $this->cat_name;
	}
	// set get cat_description
	public function setcatdescription($cat_description) {
		$this->cat_description = $cat_description;
	}
	public function getcatdescription() {
		return $this->cat_description;
	}
	// set get cat_root
	public function setcatroot($cat_root) {
		$this->cat_root = $cat_root;
	}
	public function getcatroot() {
		return $this->cat_root;
	}
	// set get priority
	public function setpriority($priority) {
		$this->priority = $priority;
	}
	public function getpriority() {
		return $this->priority;
	}
	// set get dispose
	public function setdispose($dispose) {
		$this->dispose = $dispose;
	}
	public function getdispose() {
		return $this->dispose;
	}
	// set get url_rewrite
	public function seturl($url_rewrite) {
		$this->url_rewrite = $url_rewrite;
	}
	public function geturl() {
		return $this->url_rewrite;
	}
	// Menu site
	public function menu()	{
		global $db;
		$sql = "select * from ". $db->tbl_fix . "product_cat";
		$result = $db->executeQuery ( $sql );
		while ( $rows = mysql_fetch_array ( $result ) ) {
			$return [] = $rows;
		}
		return $return;
	}	
	
	// check login
	public function listall() {
		GLOBAL $db;
		$sql = "SELECT * FROM " . $db->tbl_fix . "product_cat";
		$result = $db->executeQuery ( $sql );
		while ( $rows = mysql_fetch_array ( $result ) ) {
			$return [] = $rows;
		}
		return $return;
	}
	// Catalog chạy ... homepage
	public function wget() {
		GLOBAL $db;
		$sql = "SELECT * FROM " . $db->tbl_fix . "product_cat where pcat_img !=''";
		$result = $db->executeQuery ( $sql );
		while ( $rows = mysql_fetch_array ( $result ) ) {
			$return [] = $rows;
		}
		return $return;
	}
	public function dequy() {
		GLOBAL $db, $main;
		$sql = "select * from " . $db->tbl_fix . "product_cat order by priority";
		$result = $db->executeQuery ( $sql );
		while ( $rows = mysql_fetch_array ( $result ) ) {
			$return [] = $rows;
		}
		$dequy = $main->dequy ( 0, $return, "|- " );
		return $dequy;
	}
	public function delete() {
		GLOBAL $db;
		$sql = "DELETE FROM " . $db->tbl_fix . "product_cat where `id` ='" . $this->id . "'";
		$db->executeQuery ( $sql );
	}

}
$cat = new category ();
?>